1. Field of the Invention
The present invention relates to processors, and in particular to technology for efficiently executing programs.
2. Related Art
Conventionally, there exist operating systems (OS) that use a single processor to process a plurality of tasks in a pseudo-parallel manner.
An OS such as this makes a processor repeatedly execute the following processing.
The processor is made to store, in a register group within the processor, control information (hereafter “contexts”) showing an execution position, a data storage location and the like of a computer program (hereafter, simply “program”) corresponding to each task, to execute the task after obtaining a program, data and the like based on the stored context, to update the context following the execution of the task, and to write the updated context into memory.
Here, for the sake of convenience, the writing of a context stored in an external memory into a register group is referred to as “restoring”, and the writing of a context stored in a register group into an external memory is referred to as “saving”.
FIG. 32 is a functional block diagram of a conventional processor 1001 that executes tasks under the control of an OS such as described above, and additionally shows a context memory 1010 that stores contexts.
Processor 1001 includes a processing execution unit 1002 that executing tasks, a processing control unit 1003 that performs controls relating to the processing conducted by processing execution unit 1002, and a register group 1004 that stores contexts of the tasks to be executed.
Register group 1004 is a collection of registers, each of which is for storing a context (i.e. a register value group) corresponding to a task.
Every time a new context is stored in register group 1004, processing execution unit 1002 obtains a program and data based on the new context, and executes a task.
Processing control unit 1003 saves a context already stored in register group 1004 by overwriting context memory 1010, judges which context should be targeted for storage in register group 1004, and restores a context by reading a targeted context from context memory 1010 based on the judgment and writing the read context into register group 1004.
As a result, it is necessary to interrupt the execution of tasks by processing execution unit 1002 for the duration of the saving, judging and restoring (i.e. updating of contexts) by processing control unit 1003.
FIG. 33 shows the execution of tasks in processor 1001, and the input/output of contexts between register group 1004 and context memory 1010.
Time flows from left to right in this diagram.
Here, the tasks are executed uniformly in the sequence task A, task B, task C and task D, and the processing returns to task A after task D.
Conventionally, when tasks are executed, the saving, judging and restoring described above are performed before a task is executed.
In other words, the saving, judging and restoring are incurred as an overhead in the execution of tasks.
Here, if a single processing cycle is defined as the processing from tasks A to D, the above OS regulates the execution sequence and timing of the tasks (i.e. schedules the tasks) in a single cycle.
Processing control unit 1003 determines, based on this schedule, a context to be targeted for storage in register group 1004 (i.e. the above judging).
By performing the above processing, it is possible for a plurality of tasks to be processed in a pseudo-parallel manner by a single processor.
Furthermore, there also exist processors that use hardware to execute the above saving, judging and restoring, and then process a plurality of tasks in a pseudo-parallel manner.
However, when a plurality of tasks are processed in a pseudo-parallel manner by a single processor as described above, efficient execution of the tasks cannot be conducted, because of the overhead incurred to perform the above saving, judging and restoring before a task is executed, and the subsequent time taken between completing one task and commencing the next task, in comparison to when a single task is executed continuously.
Particularly in the case of broadcasting devices and the like, such as television receivers and communication devices (e.g. mobile telephones), it is necessary for data processing to be executed under near realtime conditions. However, when a plurality of tasks are processed in a pseudo-parallel manner in devices such as these, it is difficult to realize the above near realtime execution of data processing using conventional task execution methods that incur the above overhead.